package com.yanqu.road.server.manger.activity.doublespring.pb;

import com.yanqu.road.entity.activity.doublespring.data.DoubleSpringZlUserData;
import com.yanqu.road.pb.activity.DoubleSpringProto;

public class DoubleSpringActivityPb {

    /**
     * 构建 DoubleSpringPlayerZlData
     * @param data
     * @return
     */
    public static DoubleSpringProto.DoubleSpringPlayerZlData.Builder buildPlayerZlData(int activityId, DoubleSpringZlUserData data) {
        DoubleSpringProto.DoubleSpringPlayerZlData.Builder builder = DoubleSpringProto.DoubleSpringPlayerZlData.newBuilder();
        builder.setActivityId(activityId);
        if (data == null) {
            builder.setExp(0);
            builder.setBysfMallFlag(false);
            builder.setQbjjMallFlag(false);
        } else {
            builder.setExp(data.getExp());
            builder.setBysfMallFlag(data.getBysfMallId() > 0);
            builder.setQbjjMallFlag(data.getQbjjMallId() > 0);
        }
        return builder;
    }
}
